package com.bit.springblogdemo.pojo.response;

import com.bit.springblogdemo.enums.RsultCodeEnum;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@Data
public class Result {
    private RsultCodeEnum code; //业务状态码 ,非Http状态码
    private String errMsg;
    private Object data;

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(RsultCodeEnum.SUCCESS);
        result.setData(data);
        return result;
    }
    public static Result fail(String errMsg){
        Result result = new Result();
        result.setCode(RsultCodeEnum.FAIL);
        result.setErrMsg(errMsg);
        return result;
    }
}
